package sougou;

public class one {
    public static void main(String[] args) {
        long passwordCount = getPasswordCount("123");
        System.out.println(passwordCount);
    }
    public static long getPasswordCount (String password) {
        // write code here
        if(password.length()==1){
            return 9;
        }
        long count = 0;
        int len = password.length();
        String str = "";
        for (int i = 0; i <= 9; i++) {
            String temp = String.valueOf(i);
            for (int j = 1; j < len; j++) {
                String t = "";
                int c=-1;
                if(((temp.charAt(0)-'0' + password.charAt(j)-'0')&1)==0){
                    count ++;
                    c = (temp.charAt(0)-'0' + password.charAt(j)-'0')/2;
                    t+=c;
                }else{
                    count+=2;
                    int a = (int)Math.ceil((temp.charAt(0)-'0' + password.charAt(j)-'0')/2.0) ;
                    int b = (int)Math.floor((temp.charAt(0)-'0' + password.charAt(j)-'0')/2.0) ;
                    if(a!=c){
                        t+=a;
                    }
                    if(b!=c){
                        t+=b;
                    }
                }
                if(temp.length()>1){
                    if(((temp.charAt(1)-'0' + password.charAt(j)-'0')&1)==0){
                        count ++;
                        c = (temp.charAt(1)-'0' + password.charAt(j)-'0')/2;
                        if(!t.contains(c+"")){
                            t+=c;
                        }
                    }else{
                        count+=2;
                        int a = (int)Math.ceil((temp.charAt(1)-'0' + password.charAt(j)-'0')/2.0) ;
                        int b = (int)Math.floor((temp.charAt(1)-'0' + password.charAt(j)-'0')/2.0) ;
                        if(!t.contains(a+"")){
                            t+=a;
                        }
                        if(!t.contains(b+"")){
                            t+=b;
                        }
                    }
                }
                temp = t;
                System.out.println(t);
            }
        }
        return count;
    }
}
